<?php

namespace App\Models\Admin;

use App\Models\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

class RoleModel extends Model
{

    const Role_Admin = 1;

    public function __construct(array $attributes = [])
    {
        $this->table = config('admin-api.database.role_table');
        parent::__construct($attributes);
    }

    public function menus(): BelongsToMany
    {
        $pivotTable = config('admin-api.database.role_menu_table');
        return $this->belongsToMany(MenuModel::class, $pivotTable, 'role_id', 'menu_id');
    }

}
